Subscription to document data

This type of subscription must be used if you want to update a single or multiple fields of the document based on a VDoc type field.

Here is a subscription definition example based on document data.

 
<subscription field-id="Field_1" name="onChange" prop-id="" subscription-class="com.axemble.vdp.mapping.extensions.ResourceBrowserMappingExtension">
        <action field-id="Field_2" prop-id="" throw-events="false" update-mode="both" action-key=""/>
</subscription>

This example indicates that on modifying "Field_1" the field "Field_2" will take the value of "Field_1" since the "action-key" attribute is empty.

subscription

The "subscription" element defines the subscription input in XML of the resource template.

Element Description Where to find more information?
field-id Modified document field and trigger of the "onChange" event.
name Name of occurred event
prop-id Not available
subscription-class Extension class: “com.axemble.vdp.mapping.extensions.ResourceBrowserMappingExtension”

on-stage

The "on-stage" element defines the input of a step on which the subscription will be run.

Element Description Where to find more information?
name System name of the concerned step The keyword « sys_CreationWizard »enables to indicate that the treament will be processed only on the action of process document creation.

action

The "action" element defines the input of an action to be performed after an event is triggered.

Element Description Where to find more information?
field-id System name of the subscribed field
prop-id Not active
throw-events Not active
update-mode Document update mode: “frontend”, “backend” ,“both”
action-key Property of trigger object obtained by introspection

The actions

Actions define all the document fields that will be updated when subscription is run. Actions can only be defined at the XML document level of the resource template. It is possible to define 1 to n actions.

The filters

Filters on steps can be placed to restrict subscriptions running on some steps. If no step has been specified, the subscription will be valid at all steps of the document. Filters are defined at the XML document level of the resource template. The on-stage tags can be present from 0 to n times.

Introspection

Introspection will let you access the object's intrinsic properties. These properties should be accessible through the "get" type methods. Introspection is possible at the "action-key" attribute level of the "action" tag.

Functions

Functions will let you perform calculations on table type fields and also let you access the extended attribute values in fields representing values of directory objects.

Function Parameters Concerned classes Description
@total(column_name) @TOTAL is still supported Column name Collection Calculates the total of a table's number column. Is applicable to a Collection type document field representing a dynamic table.
@average(column_name) @AVERAGE is still supported Column name Dynamic table Calculates the average of a table's number column. Is applicable to a Collection type document field representing a dynamic table.
@get(key) Key of map element Map Is applicable to a Map type document field representing values stored of a JSP Browser. It lets you retrieve the value of a key.
@toDirectoryElement(field_name) Field name User, Group, Organization Builds a DirectoryElement type object from a string stored in another field. Is applicable to a DirectoryElement type document field.
@getOrganizationAttribute (field_name) Attribute name String Retrieves an extended attribute of an organization. Is applicable to a Character string type document field representing the name of an organization.
@getLocalizationAttribute (field_name) Attribute name String Retrieves an extended attribute of a localization. Is applicable to a Character string type document field representing the name of a localization
@getUserAttribute(field_name) Attribute name String Retrieves an extended attribute of a user. Is applicable to a Character string type document field representing the user login
@trunc(value,endIndex) String End index String Integer Truncates the element content by the number of characters specified by ‘endIndex’. Applies on a document field of characters string type or on another function recovering a character string.
@copy(field_name) Field name String Get the property back and copy its content in the subscribed field. Types must be similar.
@toString(field_name) Field name String Get the property back and convert its content in the character string.
@concat(value1,value2,value3,….) String list String Do the concatenation of the elements given as parameters. valueX can be : - the name of a characters string-type field. - a character string surrounded by « ‘ » « ’ » - an other function getting back to a string ( @toString(..) for example )

Example

<subscription field-id="Field_0" name="onChange" prop-id="" subscription-class="com.axemble.vdp.mapping.extensions.ResourceBrowserMappingExtension">
        <action field-id="Field_1" prop-id="" throw-events="false" update-mode="both" action-key="@copy(Field_2)"/>
        <action field-id="Field_3" prop-id="" throw-events="false" update-mode="both" action-key="@toString(sys_CreationDate)"/>
        <action field-id="Field_4" prop-id="" throw-events="false" update-mode="both" action-key="@concat(Field_5,’-‘,@toString(sys_Reference))"/>
</subscription>
 

On the modification of the « Field_0 » field:

  • The « Field_1 » will get the content of the « Field_2 ».
  • The « Field_3 », which must be text-type, will get the content of the « sys_CreationDate » field (document creation date) changed in string.
  • The « Field_4 », which must be text-type, will get the concatenation of the « Field_5 » content,text-type too, of the « - » character string and of the content changed in string of the « sys_Reference» field (document reference).